import axios from 'axios';
axios.defaults.baseURL = 'http://klxin.cn:8888/api/private/v1/';
//20、分类参数管理===>>>> 删除参数---------------------------
export var deleteCate_api = (params) => {
  return axios.delete(`categories/${params.id}/attributes/${params.attrid}`);
};
//21、分类参数管理===>>>> 编辑修改参数---------------------------
export var editCategories_api = (params) => {
  return axios.put(`categories/${params.cat_id}/attributes/${params.attr_id}`, {
    attr_name: params.attr_name,
    attr_sel: params.attr_sel
  });
};
//22、商品列表====>>> 获取商品列表--------------------------
export var getGoodsList_api = (params) => {
  return axios.get('goods', {
    params: {
      query: params.query,
      pagenum: params.pagenum,
      pagesize: params.pagesize
    }
  });
};
//23、商品列表====>>> 删除商品列表--------------------------
export var delGoodsList_api = (params) => {
  return axios.delete(`goods/${params.goods_id}`);
};
//24、参数列表====>>>添加动态参数或者静态属性----------------
export var addParams_api = (params) => {
  return axios.post(`categories/${params.id}/attributes`, {
    attr_name: params.attr_name,
    attr_sel: params.attr_sel,
    attr_vals: params.attr_vals
  });
};
//25、===============================================
export var putCategories_api = (params) => {
  return axios.put(`categories/${params.id}/attributes/${params.attrId}`, {
    attr_name: params.attr_name,
    attr_sel: params.attr_sel,
    attr_vals: params.attr_vals,
  });
};
//26、商品列表-----编辑提交参数-----------------
export var editGoodsList_api = (params) => {
  return axios.put(`goods/${params.goods_id}`, {
    goods_name: params.goods_name,
    goods_price: params.goods_price,
    goods_number: params.goods_number,
    goods_weight: params.goods_weight
  });
};
//27、删除商品分类
export var deleteCategories_api = (params) => {
  return axios.delete(`categories/${params.cat_id}`);
};
//添加商品----------------------
export var addGoodsAll_api = (params) => {
  return axios.post('goods', {
    goods_cat: params.goods_cat,
    goods_name: params.goods_name,
    goods_price: params.goods_price,
    goods_weight: params.goods_weight,
    goods_number: params.goods_number,
    goods_introduce: params.goods_introduce,
    pics: params.pics,
    attrs: params.attrs,
  });
};
//28、获取数据统计-----------------------------
export var getReports_api=()=> {
  return axios.get('reports/type/1');
};
//29、订单数据列表---------------------------
export var getOrderList_api=(params)=>{
   return axios.get('orders',{
     params:{
       pagenum:params.pagenum,
       pagesize:params.pagesize
     }
   });
};

